package com.eshidai.simple_springboot.task;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class ScheduledTask {
	
	private static final Logger logger = LoggerFactory.getLogger(ScheduledTask.class);
	private static final SimpleDateFormat sdf = new SimpleDateFormat("HH:mm:ss");
	
	//@Scheduled(fixedRate = 5000)
	public void reportWeather() {
		System.out.println("现在的时间是："+sdf.format(new Date())+"天气：晴");
		logger.info("现在的时间是："+sdf.format(new Date())+"天气：晴");
	}
}
